/*
 * This file is part of Catfish.
 * Copyright (C) 2010 Namazu Studios LLC
 * 
 * Catfish is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of 
 * the License, or (at your option) any later version.
 * 
 * Catfish is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with Catfish.  If not, please visit:
 *  
 * http://www.gnu.org/licenses/
 *  
 */
package com.namazustudios.catfish.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.namazustudios.catfish.generator.IdentityGenerator;

/**
 * Annotates the "Key" of this datastore entity. This may only annotate fields
 * whose type is Key.
 * 
 * @author patricktwohig
 * 
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EntityKey {

	/**
	 * The name of the identity generator to use when a key is null. This, by
	 * default uses the "random" generator.
	 * 
	 * @return the name of the identity generator used to generate the identiy
	 *         of this object
	 */
	public String identityGenerator() default "random";

	/**
	 * A property which allows for the spcification of a type, rather than a
	 * name. If this is specified then it will override the identityGenerator
	 * property and replace it with the fully qualified name of the class.
	 */
	public Class<? extends IdentityGenerator<?>> identityGeneratorType() default InvalidType.class;

}
